package com.bilicute.libman.mapper;

import com.bilicute.libman.pojo.Record;
import org.apache.ibatis.annotations.*;

import java.util.Map;

/**
 * @所属包名: com.bilicute.libman.mapper
 * @类名: RecordMapper
 * @作者: i囡漫笔
 * @描述:
 * @创建时间: 2024-06-28 22:35
 */

@Mapper
public interface RecordMapper {
    @Insert("insert into record(record_id, record_book_name , record_book_isbn , record_borrower , record_borrow_time ) " +
            "value(#{record_id}, #{record_book_name}, #{record_book_isbn}, #{record_borrower}, now())")
    void newRecord(Map<String, Object> map);

    @Update("UPDATE record SET record_remand_time = now() WHERE record_id = #{record_id}")
    void returnBook(String record_id);

    @Select("SELECT COUNT(*) FROM record")
    Integer getAllNum();
}
